import React, {Component} from 'react';
import {connect} from 'react-redux';

import {Plus} from '../components';

import plus from './actions';

const mapStateToProps = (state, ownProps) => {
  return {count: state.count}
}

const mapActionsToProps = (dispatch) => {
  return {
    plus: () => {
      dispatch(plus())
    }
  }
}

class App extends Component {
  constructor(props) {
    super();

    this.props = props;
    console.log(this.props);
  }

  render() {
    return (
      <div>
        <input type="text" value={this.props.count} />
        <button onClick={() => this.props.plus()}>click</button>
      </div>
    )
  }
}

export default connect(mapStateToProps, mapActionsToProps)(App);